import fractions, math, decimal

# float
f = 2.0
print(f"{f = }, {f.hex() = }")
f = -1.5
print(f"{f = }, {f.hex() = }")
print(f"{2e3 = }, {2e-3 = }")

# fraction
print(f"{(half1 := fractions.Fraction(2,4)) = }")
print(f"{(pi := fractions.Fraction(math.pi).limit_denominator(100)) = }")
print(f"{(half2 := fractions.Fraction('5/10')) = }")
print(f"{half1 + half2 == 1 = }")

# decimal
print(f"{0.1 + 0.2 = }")
print(f'{decimal.Decimal("0.1") + decimal.Decimal("0.2") = }')

# complex
c = complex(3, 4)
print(f"{c = }, {c.real = }, {c.imag = }")
print(f"{abs(c) = }")
